package com.ebocy.hammer.battle.fight.message;

import java.util.Set;

import com.ebocy.hammer.core.constants.GameMessageCode;
import com.ebocy.hammer.core.domain.GamePlayer;
import com.ebocy.hammer.core.message.AbstractS2CMessage;

public class S2CEnterRoomMessage extends AbstractS2CMessage{

	private Set<GamePlayer> players;
	public S2CEnterRoomMessage(Set<GamePlayer> players){
		this.players=players;
	}

	@Override
	protected void writeMessage() {
		writeShort((short) players.size());
		for(GamePlayer gamePlayer:players){
			writeString(gamePlayer.getId());
			writeShort(gamePlayer.getX());
			writeShort(gamePlayer.getY());
			writeByte(gamePlayer.getDir());
		}
	}

	@Override
	public short getMessageCode() {
		return GameMessageCode.ENTER_ROOM;
	}

}
